<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>清仓数据列表</title>
<style type="text/css">
<!--
.STYLE1 {
	color: #FF0000;
	font-weight: bold;
}
.red,.red td{color:red !important;}
.statesty1{color:#FF0000 !important;}
.statesty2{color:#FF9900 !important;}
-->
</style>
<body class="withvernav">
<style type="text/css">
	thead tr td{
		vertical-align: middle ; text-align: center;
	}
</style>
<div class="bodywrapper"> {{include file='/public/leftmenu.tpl'}}
  <div class="centercontent">
    <div class="pageheader notab">
      <h1 class="pagetitle">清仓数据列表</h1>
     
<div class="menulist">
		<ul class="profile_summary">
        {{if $sys_goodsClear==1}}
        	<li><a href="/sales/ajaxbutton?op=getclearList"><span>待清仓商品列表</span></a></li>
       		<li><a href="/sales/ajaxbutton?op=unSaleGoods"><span>滞销商品报表</span></a></li>
        {{/if}}
       </ul>
   </div>
</div>
<!--pageheader-->
    
    <div id="contentwrapper" class="contentwrapper" >
      <div id="basicform" class="subcontent">
          <!--搜索栏-->
<div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
<form class="stdform stdform2" method="get" action="/Sales/ajaxbutton" style="display:none">
    	<input name="op" value="unSaleGoods" type="hidden">
      <div class="tableoptions" style="position:relative"> SKU：<input type="text" name="search_sku" id="search_sku" value="{{$search_sku}}" class="width100">&nbsp;
       入库时间超过:<input type="text" name="limit_month" id="limit_month" class="width100" value="{{$limit_month}}" style="width:50px;" />个月({{$imit_month_date}})   &nbsp;滞销率大于:<input type="text" name="unsalelilv" id="unsalelilv" class="width100" style="width:60px;" value="{{$unsalelilv}}" />%
        <button class="btn btn_orange btn_search radius50">Search</button>
</div>
</form>
    <form class="stdform stdform2" id="formlist" method="post" action="/Sales/goodsClear">
    <input type="hidden" name="limit_month" id="limit_month" value="{{$limit_month}}" style="width:50px;" />
    <input type="hidden" name="unsalelilv" id="unsalelilv" style="width:60px;" value="{{$unsalelilv}}" />
    <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
                <thead>
                <tr>
                  <th class="head1">id</th>
                    <th class="head1">清仓商品</th>
                    <th class="head1">清仓仓库</th>
                    <th class="head1">清仓库存数</th>
                    <th class="head1">库存价值</th>
                  <th class="head1">创建者</th>
                  <th class="head1">状态</th>
                  <th class="head1">操作</th>
                </tr>
                </thead>
                <tbody>
                {{foreach from=$datalist item=li key=key}}
                <tr>
                  <td>{{$li.id}}
                      <input type='hidden' name='good_sku[{{$li.id}}]' value="{{$li.goods_sku}}"></td>
                    <td><a href="javascript:;" onClick="clearDetail({{$li.id}})">{{$li.createtime|substr:0:16}}清仓商品</a></td>
                    <td>{{$li.storage_name}}</td>
                    <td>{{$li.stock_count}}</td>
                    <td>{{$li.cost_price}}</td>
                    <td>{{$li.creator}}</td>
                  <td><span class="statesty{{$li['status']}}">{{$status[$li['status']]}}</span></td>
                  <td>
                  {{if $sys_goodsClear_inventory==1}}
                  	{{if $li.status eq 1}}<a href="javascript:;" onClick="showConifrmForm({{$li.id}})">盘点库存</a>{{/if}}
                  {{/if}}
                    {{if $sys_goodsClear_check==1}}
                  {{if $li.status eq 2}}<a href="javascript:;" onClick="setClear({{$li.id}})">设置清仓价格</a>{{/if}} &nbsp;
                  	{{/if}}
                  <a href="javascript:;" onClick="clearDetail({{$li.id}})">查看详细</a> &nbsp;
                  
                   {{if $sys_goodsClear_inventory==1 || $sys_goodsClear==1}}
                  {{if $li.status lt 3}}<a href="/sales/ajaxbutton?op=delClearInfo&infoid={{$li.id}}" onClick="return confirm('确定删除吗?');">删除</a>{{/if}}
                  {{/if}}
                  </td>
      </tr>
                {{/foreach}}    
                </tbody>
            </table>
    </form>
      </div>
<div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
      </div>


  <div class="modal fade" id="endorderform" tabindex="-1" role="dialog" aria-labelledby="sendorderform" aria-hidden="true">
    <div class="modal-dialog" style="width:70%;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="sendorderform">清仓商品列表</h4>
        </div>
        <div class="modal-body">
         <span id="errshow"></span>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
          
          <div style="width:100%;overflow:auto; border:0px solid;">
           <span id="endorderlistst">
           </span>
           <span id="fileinput"></span>
          </div>
          </table>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
<script type="text/javascript">
	function applyGoodsClear(){
		$("#formlist").submit();
	}
	function showConifrmForm(dataid){
		$.get("/sales/ajaxbutton?op=setGoodsClearState",{"dataid":dataid},function(data){
			$("#endorderlistst").html(data);
			$('#endorderform').modal('show');
			///sales/ajaxbutton?op=updateStock&needid=	
		})
	}
	function setClear(dataid){
		$.get("/sales/ajaxbutton?op=setClear",{"dataid":dataid},function(data){
			$("#endorderlistst").html(data);
			$('#endorderform').modal('show');
			///sales/ajaxbutton?op=updateStock&needid=	
		})
	}
	function clearDetail(dataid){
		$.get("/sales/ajaxbutton?op=clearGoodsDetail",{"dataid":dataid},function(data){
			$("#endorderlistst").html(data);
			$('#endorderform').modal('show');
			///sales/ajaxbutton?op=updateStock&needid=	
		})
	}
</script>
</body>
</html>